
<!DOCTYPE html>
<!-- saved from url=(0048)http://192.168.0.126:82/jiayin/web/shopcar.html# -->
<html><head lang="en"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
    <title>微商城-购物车</title>
    <link href="css/style.css" type="text/css" rel="stylesheet"/>
    <link href="css/shopcar.css" type="text/css" rel="stylesheet"/>
    <script src="js/zepto.min.js"></script>
    <script>
        function calPrice(){
              var table = document.getElementById("t1");
              var rows = table.getElementsByTagName("li");
              var total =0;
              for(var i=0;i<rows.length;i++){
                  var curRow = rows[i];
                  var cells = curRow.getElementsByTagName("input");
                  var checked = cells[0];
                  var price = parseFloat(cells[1].value);
                  var num = parseInt(cells[3].value);
                  var sum = price*num;
                  if(checked.checked){
                      total +=sum;
                  }else{
                      var c_check=document.getElementById("c_check");
                      c_check.checked = false;
                  }
              }
              var totalprice = document.getElementById("c_priceTotal");
              totalprice.value = total.toFixed(2);
//            var product = document.getElementsByName("product");
//            var product2 = document.getElementsByName("product2");
//            var price1 =parseInt(product1[1].value)*parseInt(product1[2].value);
//            var price2 =parseInt(product2[1].value)*parseInt(product2[2].value);
//            var checked1 = product1[0];
//            var checked2 = product2[0];
//            var totalprice;
//            if(checked1.checked==true&&checked2.checked==true){
//                totalprice = price1+price2;
//            }else if(checked1.checked==true&&checked2.checked==false){
//                totalprice = price1;
//            }else if(checked2.checked==true&&checked1.checked==false){
//                totalprice = price2;
//            }else if(checked1.checked==false&&checked2.checked==false){
//                totalprice = 0.00;
//                }
//            var total = document.getElementById("c_priceTotal");
//            total.value = totalprice.toFixed(2);
        }
        $(document).ready(function(){
            $(".c_btn").click(function(){
                calPrice();
            });
			$(".c_btn1").click(function(){
				if('checked' == $(this).attr('checked')){
					$(this).removeAttr('checked');
					$('.c_btn').each(function(){
					$(this).removeAttr('checked');
					});
				}else{
					$(this).attr('checked', 'checked')
					$('.c_btn').each(function(){
					if(!$(this).attr('checked')){
						$(this).attr('checked', 'checked');
					}
					});
				}
				calPrice();
            });
            $(".c_sub").click(function(){
                var n=$(this).next().val();
                var num=parseInt(n);
                if(num>0){num--;}
                $(this).next().val(num);
                calPrice();
            });
            $(".c_add").click(function(){
                var n=$(this).prev().val();
                var num=parseInt(n);
                num++;
                $(this).prev().val(num);
                calPrice();
            });
        })
    </script>
</head>
<body>
<!--布局开始了-->
    <!--header bengin-->
<div class="l_header">
    <div class="c_back">
        <a href="javascript:history.back()"></a>
    </div>
    <div class="c_logo"></div>
    <p class="c_title">购物车</p>
</div>
    <!--header end-->
    <!--main bengin-->
    <section class="l_main">
        <ul class="m_order_main">
            <li class="m_order_list">
                <h3>
                    <span id="c_btn"><input type="checkbox" class="c_check c_btn1" id="c_check" checked="checked"></span>
                    <span class="c_shopname"><a href="#">索菲亚衣柜</a></span>
                    <span class="c_right_btn"><img src="images/right_btn.png"></span>
                </h3>
                <ul class="m_m_order_list" id="t1">
                    <li class="m_m_order_list_1">
                        <div><input type="checkbox" class="c_check c_btn" name="product" checked="checked"></div>
                        <div class="c_product"><img src="images/product1.jpg"></div>
                        <dl class="m_order_list_content">
                            <dt>索菲亚纯色现代精致卧室套餐/衣柜书柜定制厂家直供价DZJWS0</dt>
                            <dd>型号：DZJWS0</dd>
                        </dl>
                        <div class="m_order_list_money">
                        <input class="c_money" type="text" name="product" id="product1" value="269.00">
                        <span><input type="button" class="c_sub" value="-"><input type="text" class="c_num" name="product" value="1"><input type="button" class="c_add" value="+"></span>
                    </div>
                    </li>
                    <li class="m_m_order_list_1">
                        <div><input type="checkbox" class="c_check c_btn" name="product" checked="checked"></div>
                        <div class="c_product"><img src="images/product1.jpg"></div>
                        <dl class="m_order_list_content">
                            <dt>索菲亚纯色现代精致卧室套餐/衣柜书柜定制厂家直供价DZJWS0</dt>
                            <dd>型号：DZJWS0</dd>
                        </dl>
                        <div class="m_order_list_money">
                            <input class="c_money" type="text" name="product" id="product2" value="1669.00">
                            <span><input type="button" class="c_sub" value="-"><input type="text" class="c_num" value="1" name="product"><input type="button" class="c_add" value="+"></span>
                        </div>
                    </li>
                </ul>
                <ul class="m_bill">
                    <li class="c_freight">不含运费</li>
                    <li class="c_total">合计：<input type="text" id="c_priceTotal" value="1938.00"></li>
                    <li class="c_buy_btn"><a href="#">去结算</a></li>
                </ul>
            </li>
            <li class="order_list"></li>
        </ul>

    </section>
    <!--main end-->
</body></html>